/**
 * 
 */
package edu.umd.clip.lm.factors;

/**
 * @author Denis Filimonov <den@cs.umd.edu>
 *
 */
public class SpeechInfo implements WordToOvertFactorInterface {
	public static final String UNFINISHED = "unfinished";
	public static final String HESITATION = "hesitation";
	public static final String APOSTROPHE = "'";
	public static final String APOSTROPHE_S = "'s";
	public static final String REGULAR = "reg";
	
	public SpeechInfo() {}
	
	/* (non-Javadoc)
	 * @see edu.umd.clip.lm.factors.WordToOvertFactorInterface#wordToOvertFactor(java.lang.String)
	 */
	@Override
	public String wordToOvertFactor(String word) {
		if (word.isEmpty()) return REGULAR;
		char ch = word.charAt(word.length()-1);
		if (ch == '\'') return APOSTROPHE;
		if (ch == '-') return UNFINISHED;
		if (ch == 's' && word.endsWith("'s")) return APOSTROPHE_S;
		if (word.equals("%hesitation")) return HESITATION;
		return REGULAR;
	}

}
